package com.chengqs.rapid.console.web;

import com.chengqs.rapid.common.config.ServiceInvoker;
import com.chengqs.rapid.console.service.ServiceDefinitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <B>主类名称：</B>ServiceInvokerController<BR>
 * <B>概要说明：</B>服务定义方法控制层<BR>
 *
 * @author: chengqs
 * @create: 2025-03-18 18:11:21
 **/
@RestController
public class ServiceInvokerController {
    @Autowired
    private ServiceDefinitionService serviceDefinitionService;

    @RequestMapping("/serviceInvoker/getListByUniqueId")
    public List<ServiceInvoker> getListByUniqueId(@RequestParam("prefixPath")String prefixPath,
                                                  @RequestParam("uniqueId")String uniqueId) throws Exception{
        List<ServiceInvoker> list = serviceDefinitionService.getServiceInvokerByUniqueId(prefixPath, uniqueId);
        return list;
    }

    @RequestMapping("/serviceInvoker/bindingRuleId")
    public void bindingRuleId(@RequestParam("prefixPath")String prefixPath,
                              @RequestParam("uniqueId")String uniqueId,
                              @RequestParam("invokerPath")String invokerPath,
                              @RequestParam("ruleId")String ruleId) throws Exception {

        serviceDefinitionService.serviceInvokerbindingRuleId(prefixPath, uniqueId, invokerPath, ruleId);
    }
}
